package ex0501;

public interface MusicBox {
	public void play();
}
class PianoBox implements MusicBox{
	public void play(){
		System.out.println("LALALA");
	}
};
class ViolinBox implements MusicBox{
	public void play(){
		System.out.println("HAHAHA");
	}
};
class MusicBoxFactory{
	public static MusicBox getlnstance(String className){
		MusicBox f=null;
		if("PianoBox".equals(className)){
			f=new PianoBox();
		}
		if("ViolinBox".equals(className)){
			f=new ViolinBox();
		}
		return f;
	}
}
